<!--待办任务页面 待办任务表单-->
<template>
    <div>
        <div class="topsubmint el-col el-col-21" v-if="!isediter">报案信息修改
            <el-button style="float: right; margin-right:50px;" type="primary" @click="eidter">提交审核</el-button>
        </div>
        <div class="topsubmint el-col el-col-21" v-else>报案信息反馈查看 </div>
        <el-card class="box-card" style="margin-top:50px;">
            <el-card class="box-card">
                <div slot="header" class="card-heaer">
                    <span style="line-height: 36px;">被保险人信息</span>
                </div>
                <el-form :inline="true" :model="peopleinfo" label-width="160px" class="demo-form-inline">
                    <el-form-item label="被保险人姓名:">
                        <el-input v-model="peopleinfo.CUSTNAME" placeholder="被保险人姓名" :disabled="true"></el-input>
                    </el-form-item>
                    <el-form-item label="被保险人联系电话:" class="padleft-150">
                        <el-input v-model="peopleinfo.MOBILE" placeholder="被保险人联系电话" :disabled="true"></el-input>
                    </el-form-item>

                </el-form>
                <el-form :inline="true" :model="peopleinfo" label-width="160px" class="demo-form-inline">
                    <el-form-item label="产品类型:">
                        <el-input v-model="peopleinfo.PRODUCTNAME" placeholder="产品类型" :disabled="true"></el-input>
                    </el-form-item>
                    <el-form-item label="保险开始时间:" class="padleft-150">
                        <el-input v-model="peopleinfo.CERTDATE" placeholder="保险开始时间" :disabled="true"></el-input>
                    </el-form-item>
                </el-form>
                <el-form :inline="true" :model="peopleinfo" label-width="160px" class="demo-form-inline">
                    <el-form-item label="保险结束时间:">
                        <el-input v-model="peopleinfo.INSURANCEENDTIME" placeholder="保险结束时间" :disabled="true"></el-input>
                    </el-form-item>
                </el-form>
                <el-form :inline="true" :model="peopleinfo" label-width="160px" class="demo-form-inline">

                    <el-form-item label="关键联络人姓名:">
                        <el-input v-model="peopleinfo.Cname" placeholder="关键联络人姓名" :disabled="true"></el-input>
                    </el-form-item>
                    <el-form-item label="关键联络人联系电话:" class="padleft-150">
                        <el-input v-model="peopleinfo.Ctel" placeholder="关键联络人联系电话" :disabled="true"></el-input>
                    </el-form-item>
                </el-form>
                <el-form :inline="true" :model="peopleinfo" label-width="160px" class="demo-form-inline">
                    <el-form-item label="与被保险人的关系:">
                        <el-input v-model="peopleinfo.CTOCRELATION" placeholder="与被保险人的关系" :disabled="true"></el-input>
                    </el-form-item>
                </el-form>
            </el-card>
            <div class="space20">
            </div>
            <!--报案人信息录入-->
            <el-card class="box-card">
                <div slot="header" class="card-heaer">
                    <span style="line-height: 36px;">报案人信息录入</span>
                </div>

                <el-form :model="reportuser" ref="reportuser" :rules="rules" label-width="200px">
                    <el-form-item label="报案人员身份:" prop="REPORTINFORMATION_IDENTITY">
                        <el-radio-group v-model="reportuser.REPORTINFORMATION_IDENTITY" :disabled="isediter">
                            <el-radio label="客户报案"></el-radio>
                            <el-radio label="力众客服报案"></el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-row type="flex" class="row-bg" v-if="reportuser.REPORTINFORMATION_IDENTITY=='力众客服报案'">
                        <el-col :span="10">
                            <el-form-item label="力众报案原因:">
                                <el-input type="textarea" v-model="reportuser.REPORTINFORMATION_IDENTITYWHY" placeholder="力众报案原因" style="width:100%;"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex" class="row-bg" v-show="reportuser.REPORTINFORMATION_IDENTITY=='客户报案'">
                        <el-col :span="6">
                            <el-form-item label="报案人与被保险人的关系:" prop="REPORTINFORMATION_RELATION">
                                <el-select placeholder="报案人与被保险人的关系" v-model="reportuser.REPORTINFORMATION_RELATION" :disabled="isediter">
                                    <el-option label="父子" value="父子"></el-option>
                                    <el-option label="母子" value="母子"></el-option>
                                    <el-option label="夫妻" value="夫妻"></el-option>
                                    <el-option label="本人" value="本人"></el-option>
                                    <el-option label="其他" value="其他"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6" :offset="6">
                            <el-form-item label="报案方式:" prop="REPORTINFORMATION_WAY">
                                <el-select placeholder="报案方式" v-model="reportuser.REPORTINFORMATION_WAY" :disabled="isediter">
                                    <el-option label="电话" value="电话"></el-option>
                                    <el-option label="微信" value="微信"></el-option>

                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex" class="row-bg" v-show="reportuser.REPORTINFORMATION_RELATION!='本人'">
                        <el-col :span="6">
                            <el-form-item label="报案人姓名:" prop="REPORTINFORMATION_USERNAME" :rules="{
                                                                                  required: reportuser.REPORTINFORMATION_IDENTITY=='客户报案' && reportuser.REPORTINFORMATION_RELATION!='本人', message: '不能为空', trigger: 'blur'
                                                                                }">
                                <el-input v-model="reportuser.REPORTINFORMATION_USERNAME" placeholder="报案人姓名" :disabled="isediter"></el-input>
                            </el-form-item>

                        </el-col>
                        <el-col :span="6" :offset="6" v-show="reportuser.REPORTINFORMATION_IDENTITY=='客户报案'">
                            <el-form-item label="报案人联系电话:" prop="REPORTINFORMATION_TEL" :rules="{
                                                                                  required: reportuser.REPORTINFORMATION_IDENTITY=='客户报案' && reportuser.REPORTINFORMATION_RELATION!='本人', message: '不能为空', trigger: 'blur'
                                                                                }">
                                <el-input v-model="reportuser.REPORTINFORMATION_TEL" placeholder="报案人联系电话" :disabled="isediter"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex" class="row-bg">
                        <el-col :span="6" v-show="reportuser.REPORTINFORMATION_IDENTITY=='客户报案' &&  reportuser.REPORTINFORMATION_RELATION!='本人'">
                            <el-form-item label="报案人邮箱:" prop="REPORTINFORMATION_EMAIL" :rules="{
                                                                                  required: reportuser.REPORTINFORMATION_IDENTITY=='客户报案' &&  reportuser.REPORTINFORMATION_RELATION!='本人', message: '不能为空', trigger: 'blur'
                                                                                }">
                                <el-input v-model="reportuser.REPORTINFORMATION_EMAIL" placeholder="报案人邮箱" style="width:100%;" :disabled="isediter"></el-input>
                            </el-form-item>
                        </el-col>

                    </el-row>
                    <el-row type="flex" class="row-bg">
                        <el-col :span="10">
                            <el-form-item label="报案事由:" prop="REPORTINFORMATION_CAUSE">
                                <el-input type="textarea" v-model="reportuser.REPORTINFORMATION_CAUSE" :disabled="isediter" placeholder="报案事由" style="width:100%;"></el-input>
                            </el-form-item>
                        </el-col>

                    </el-row>
                </el-form>
            </el-card>
            <div v-for="(item,index) in fromlist" :key="index">
                <div class="space20">
                </div>
                <keep-alive>
                    <medical :ref="index+1" :newState="'待办任务'" :model="index" :newIsEditer="item.obj.RI_MEDICAL_STATE=='需修改'" v-if="item.key=='medical'" :ischeck="false"></medical>
                </keep-alive>

                <harmDie :ref="index+1" :newState="'待办任务'" :model="index" :newIsEditer="item.obj.RI_DIED_STATE=='需修改'" :ischeck="false" :modelrules="harmDieRules" :name="item.key" v-if="item.key=='harmDie'"></harmDie>
                <harmDisability :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_INJURE_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="harmDisabilityRules" v-if="item.key=='harmDisability'"></harmDisability>
                <rescueMeidca :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_HMEDIA_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="rescueMeidcaRules" v-if="item.key=='rescueMeidca'"></rescueMeidca>
                <rescueMove :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_HCHANGE_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="rescueMoveRules" v-if="item.key=='rescueMove'"></rescueMove>
                <rescueReturned :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_HBACK_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="rescueReturnedRules" v-if="item.key=='rescueReturned'"></rescueReturned>
                <rescueVisit :ref="index+1" :newState="'代办任务'" :newIsEditer="item.obj.RI_HVISIT_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="rescueVisitRules" v-if="item.key=='rescueVisit'"></rescueVisit>
                <rescueInter :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_HBURIAL_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="rescueInterRules" v-if="item.key=='rescueInter'"></rescueInter>
                <studyBreak :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_ACADEMIC_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="studyBreakRules" v-if="item.key=='studyBreak'"></studyBreak>
                <travelDelay :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_TRAVELDELAY_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="travelDelayRules   " v-if="item.key=='travelDelay'"></travelDelay>
                <travelLose :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_LOSE_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="travelLoseRules" v-if="item.key=='travelLose'"></travelLose>
                <three :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_OTHER_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="threeRules" v-if="item.key=='three'"></three>
                <rescueAccompany :ref="index+1" :newState="'待办任务'" :newIsEditer="item.obj.RI_HACCOMPANY_STATE=='需修改'" :ischeck="false" :name="item.key" :model="index" :modelrules="rescueAccompanyRules" v-if="item.key=='rescueAccompany'"></rescueAccompany>
            </div>

        </el-card>
    </div>
</template>

<script>
import medical from '@/components/reportForm/medical';
import harmDie from '@/components/reportForm/harmDie';
import harmDisability from '@/components/reportForm/harmDisability';
import rescueMeidca from '@/components/reportForm/rescueMeidca';
import rescueMove from '@/components/reportForm/rescueMove';
import rescueReturned from '@/components/reportForm/rescueReturned';
import rescueVisit from '@/components/reportForm/rescueVisit';
import rescueInter from '@/components/reportForm/rescueInter';
import studyBreak from '@/components/reportForm/studyBreak';
import travelDelay from '@/components/reportForm/travelDelay';
import travelLose from '@/components/reportForm/travelLose';
import three from '@/components/reportForm/three';
import rescueAccompany from '@/components/reportForm/rescueAccompany';
import {
    mapState
} from 'vuex';
import getid from '@/js/getid';
export default {
    data() {
        return {
            peopleinfo: {},
            //是否可删除
            checkmedical: true,
            isediter: false,//是否可以编辑 true为不可编辑     

        }
    },
    components: {
        'medical': medical,
        'harmDie': harmDie,
        'harmDisability': harmDisability,
        'rescueMeidca': rescueMeidca,
        'rescueMove': rescueMove,
        'rescueReturned': rescueReturned,
        'rescueVisit': rescueVisit,
        'rescueInter': rescueInter,
        'studyBreak': studyBreak,
        'travelDelay': travelDelay,
        'travelLose': travelLose,
        'three': three,
        'rescueAccompany': rescueAccompany
    },
    computed: mapState({
        // 报案人信息
        reportuser: state => state.reportform.reportuser,
        rules: state => state.reportform.rules,
        reporttype: state => state.reportform.reporttype,
        //报案类型数组
        fromlist: state => state.reportform.fromlist,
        //医疗保险报案信息
        medical: state => state.reportform.medical,
        //意外死亡
        harmDie: state => state.reportFormItem.harmDie,
        harmDieRules: state => state.reportFormItem.harmDieRules,
        //意外伤残
        harmDisability: state => state.reportFormItem.harmDisability,
        harmDisabilityRules: state => state.reportFormItem.harmDisabilityRules,
        //全球紧急救援-紧急医疗
        rescueMeidca: state => state.reportFormItem.rescueMeidca,
        rescueMeidcaRules: state => state.reportFormItem.rescueMeidcaRules,
        //陪同
        rescueAccompany: state => state.reportFormItem.rescueAccompany,
        rescueAccompanyRules: state => state.reportFormItem.rescueAccompanyRules,
        //全球紧急救援-紧急转院
        rescueMove: state => state.reportFormItem.rescueMove,
        rescueMoveRules: state => state.reportFormItem.rescueMoveRules,
        //全球紧急救援-紧急运返
        rescueReturned: state => state.reportFormItem.rescueReturned,
        rescueReturnedRules: state => state.reportFormItem.rescueReturnedRules,
        //全球紧急救援-探访
        rescueVisit: state => state.reportFormItem.rescueVisit,
        rescueVisitRules: state => state.reportFormItem.rescueVisitRules,
        //全球紧急救援-探访
        rescueInter: state => state.reportFormItem.rescueInter,
        rescueInterRules: state => state.reportFormItem.rescueInterRules,
        //学业中断
        studyBreak: state => state.reportFormItem.studyBreak,
        studyBreakRules: state => state.reportFormItem.studyBreakRules,
        //旅行延误
        travelDelay: state => state.reportFormItem.travelDelay,
        travelDelayRules: state => state.reportFormItem.travelDelayRules,
        //旅行延误
        travelLose: state => state.reportFormItem.travelLose,
        travelLoseRules: state => state.reportFormItem.travelLoseRules,
        //旅行延误
        three: state => state.reportFormItem.three,
        threeRules: state => state.reportFormItem.threeRules,
    }),
    methods: {
        eidter() {
            let that = this;
            var arr = [];
            //报案人信息
            var model = JSON.parse(JSON.stringify(that.reportuser));
            model.REPORTINFORMATION_STATE = "需审核";
            model.RI_MEDICAL = new Array;
            model.RI_ACADEMIC = new Array;
            model.RI_HBACK = new Array;
            model.RI_HBURIAL = new Array;
            model.RI_HCHANGE = new Array;
            model.RI_HMEDIA = new Array;
            model.RI_HVISIT = new Array;
            model.RI_LOSE = new Array;
            model.RI_OTHER = new Array;
            model.RI_TRAVELDELAY = new Array;
            model.RI_DIED = new Array;
            model.RI_INJURE = new Array;
            model.RI_HACCOMPANY = new Array;
            for (var i = 0; i < that.fromlist.length; i++) {
                var resultModel = JSON.parse(JSON.stringify(that.fromlist[i].obj));
                switch (that.fromlist[i].key) {
                    case 'medical':
                        if (resultModel.RI_MEDICAL_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_MEDICAL_ADDRESS) {
                            resultModel.RI_MEDICAL_ADDRESS = resultModel.RI_MEDICAL_ADDRESS.join(",");
                        }

                        if (resultModel.RI_MEDICAL_STATE == "需修改") {
                            resultModel.RI_MEDICAL_STATE == "需审核";
                            resultModel.RI_MEDICAL_WHY = ""
                        }
                        model.RI_MEDICAL.push(resultModel);
                        break;
                    case 'harmDie':
                        if (resultModel.RI_DIED_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_DIED_STATE == "需修改") {
                            resultModel.RI_DIED_STATE == "需审核";
                            resultModel.RI_DIED_WHY = ""
                        }
                        if (resultModel.RI_DIED_ADDRESS) {
                            resultModel.RI_DIED_ADDRESS = resultModel.RI_DIED_ADDRESS.join(",");
                        }
                        model.RI_DIED.push(resultModel);
                        break;
                    case 'harmDisability':
                        if (resultModel.RI_INJURE_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_INJURE_STATE == "需修改") {
                            resultModel.RI_INJURE_STATE == "需审核";
                            resultModel.RI_INJURE_WHY = ""
                        }
                        if (resultModel.RI_INJURE_ADDRESS) {
                            resultModel.RI_INJURE_ADDRESS = resultModel.RI_INJURE_ADDRESS.join(",");
                        }
                        model.RI_INJURE.push(resultModel);
                        break;
                    case 'rescueMeidca':
                        if (resultModel.RI_HMEDIA_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_HMEDIA_STATE == "需修改") {
                            resultModel.RI_HMEDIA_STATE == "需审核";
                            resultModel.RI_HMEDIA_WHY = "";
                        }
                        if (resultModel.RI_HMEDIA_ADDRESS) {
                            resultModel.RI_HMEDIA_ADDRESS = resultModel.RI_HMEDIA_ADDRESS.join(",");
                        }
                        model.RI_HMEDIA.push(resultModel);
                        break;
                    case 'rescueMove':
                        if (resultModel.RI_HCHANGE_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_HCHANGE_STATE == "需修改") {
                            resultModel.RI_HCHANGE_STATE == "需审核";
                            resultModel.RI_HCHANGE_WHY = "";
                        }
                        if (resultModel.RI_HCHANGE_ADDRESS) {
                            resultModel.RI_HCHANGE_ADDRESS = resultModel.RI_HCHANGE_ADDRESS.join(",");
                        }
                        model.RI_HCHANGE.push(resultModel);
                        break;
                    case 'rescueReturned':
                        if (resultModel.RI_HBACK_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_HBACK_STATE == "需修改") {
                            resultModel.RI_HBACK_STATE == "需审核";
                            resultModel.RI_HBACK_WHY = "";
                        }
                        if (resultModel.RI_HBACK_ADDRESS) {
                            resultModel.RI_HBACK_ADDRESS = resultModel.RI_HBACK_ADDRESS.join(",");
                        }
                        model.RI_HBACK.push(resultModel);
                        break;
                    case 'rescueVisit':
                        if (resultModel.RI_HVISIT_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_HVISIT_STATE == "需修改") {
                            resultModel.RI_HVISIT_STATE == "需审核";
                            resultModel.RI_HVISIT_WHY = "";
                        }
                        if (resultModel.RI_HVISIT_ADDRESS) {
                            resultModel.RI_HVISIT_ADDRESS = resultModel.RI_HVISIT_ADDRESS.join(",");
                        }
                        model.RI_HVISIT.push(resultModel);
                        break;
                    case 'rescueAccompany':
                        if (resultModel.RI_HACCOMPANY_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_HACCOMPANY_STATE == "需审核") {
                            resultModel.RI_HACCOMPANY_STATE == "需审核";
                            resultModel.RI_HACCOMPANY_WHY = "";
                        }
                        if (resultModel.RI_HACCOMPANY_ADDRESS) {
                            resultModel.RI_HACCOMPANY_ADDRESS = resultModel.RI_HACCOMPANY_ADDRESS.join(",");
                        }
                        model.RI_HACCOMPANY.push(resultModel);
                        break;
                    case 'rescueInter':
                        if (resultModel.RI_HBURIAL_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_HBURIAL_STATE == "需修改") {
                            resultModel.RI_HBURIAL_STATE == "需审核";
                            resultModel.RI_HBURIAL_WHY = "";
                        }
                        if (resultModel.RI_HBURIAL_ADDRESS) {
                            resultModel.RI_HBURIAL_ADDRESS = resultModel.RI_HBURIAL_ADDRESS.join(",");
                        }
                        model.RI_HBURIAL.push(resultModel);
                        break;
                    case 'studyBreak':
                        if (resultModel.RI_ACADEMIC_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_ACADEMIC_STATE == "需修改") {
                            resultModel.RI_ACADEMIC_STATE == "需审核";
                            resultModel.RI_ACADEMIC_WHY = "";
                        }
                        model.RI_ACADEMIC.push(resultModel);
                        break;
                    case 'travelDelay':
                        if (resultModel.RI_TRAVELDELAY_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_TRAVELDELAY_STATE == "需修改") {
                            resultModel.RI_TRAVELDELAY_STATE == "需审核";
                            resultModel.RI_TRAVELDELAY_WHY = "";
                        }
                        model.RI_TRAVELDELAY.push(resultModel);
                        break;
                    case 'travelLose':
                        if (resultModel.RI_LOSE_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_LOSE_STATE == "需修改") {
                            resultModel.RI_LOSE_STATE == "需审核";
                            resultModel.RI_LOSE_WHY = "";
                        }
                        model.RI_LOSE.push(resultModel);
                        break;
                    case 'three':
                        if (resultModel.RI_OTHER_STATE == "需审核") {
                            this.$alert('您还没有审核', '提示', {
                                confirmButtonText: '确定',
                            });
                            return;
                        }
                        if (resultModel.RI_OTHER_STATE == "需修改") {
                            resultModel.RI_OTHER_STATE == "需审核";
                            resultModel.RI_OTHER_WHY = "";
                        }
                        if (resultModel.RI_OTHER_ADDRESS) {
                            resultModel.RI_OTHER_ADDRESS = resultModel.RI_OTHER_ADDRESS.join(",");
                        }

                        model.RI_OTHER.push(resultModel);
                        break;
                }

            }

            that.$http.post("ReportInfomation/chang", model).then(response => {
                var data = response.body;
                if (data.code == 1) {
                    // that.$store.commit('fromlistEmpty', []);
                    that.$notify({
                        title: '修改完成',
                        message: '修改完成',
                        type: 'success'
                    });
                    that.$router.push({
                        name: 'ReportChange'
                    });

                } else {

                    that.$notify.error({
                        title: '提交失败',
                        message: data.msg
                    });
                }
            }, response => {

                that.$notify.error({
                    title: '网络错误',
                    message: '网络错误'
                });

            })

        },
        listget(arry, key) {
            if (arry == null) {
                return;
            }
            for (var i = 0; i < arry.length; i++) {
                switch (key) {
                    case 'medical':
                        if (arry[i].RI_MEDICAL_ADDRESS)
                            arry[i].RI_MEDICAL_ADDRESS = this.addressGet(arry[i].RI_MEDICAL_ADDRESS);
                        break;
                    case 'harmDie':
                        if (arry[i].RI_DIED_ADDRESS)
                            arry[i].RI_DIED_ADDRESS = this.addressGet(arry[i].RI_DIED_ADDRESS);
                        break;
                    case 'harmDisability':
                        if (arry[i].RI_INJURE_ADDRESS)
                            arry[i].RI_INJURE_ADDRESS = this.addressGet(arry[i].RI_INJURE_ADDRESS);
                        break;
                    case 'rescueMeidca':
                        if (arry[i].RI_HMEDIA_ADDRESS)
                            arry[i].RI_HMEDIA_ADDRESS = this.addressGet(arry[i].RI_HMEDIA_ADDRESS);
                        break;
                    case 'rescueMove':
                        if (arry[i].RI_HCHANGE_ADDRESS)
                            arry[i].RI_HCHANGE_ADDRESS = this.addressGet(arry[i].RI_HCHANGE_ADDRESS);
                        break;
                    case 'rescueReturned':
                        if (arry[i].RI_HBACK_ADDRESS)
                            arry[i].RI_HBACK_ADDRESS = this.addressGet(arry[i].RI_HBACK_ADDRESS);
                        break;
                    case 'rescueVisit':
                        if (arry[i].RI_HVISIT_ADDRESS)
                            arry[i].RI_HVISIT_ADDRESS = this.addressGet(arry[i].RI_HVISIT_ADDRESS);
                        break;
                    case 'rescueAccompany':
                        if (arry[i].RI_HACCOMPANY_ADDRESS)
                            arry[i].RI_HACCOMPANY_ADDRESS = this.addressGet(arry[i].RI_HACCOMPANY_ADDRESS);
                        break;
                    case 'rescueInter':
                        if (arry[i].RI_HBURIAL_ADDRESS)
                            arry[i].RI_HBURIAL_ADDRESS = this.addressGet(arry[i].RI_HBURIAL_ADDRESS);
                        break;
                    case 'studyBreak':

                        break;
                    case 'travelDelay':
                        arry[i].BILL_TRAVELDELAY_FACTARBILLVE = new Date((new Date(arry[i].BILL_TRAVELDELAY_FACTARBILLVE) / 1000 + 28800) * 1000);
                        arry[i].BILL_TRAVELDELAY_FACTOUT = new Date((new Date(arry[i].BILL_TRAVELDELAY_FACTOUT) / 1000 + 28800) * 1000);
                        arry[i].BILL_TRAVELDELAY_PLANARBILLVE = new Date((new Date(arry[i].BILL_TRAVELDELAY_PLANARBILLVE) / 1000 + 28800) * 1000);
                        arry[i].BILL_TRAVELDELAY_PLANOUT = new Date((new Date(arry[i].BILL_TRAVELDELAY_PLANOUT) / 1000 + 28800) * 1000);
                        break;
                    case 'travelLose':

                        break;
                    case 'three':
                        if (arry[i].RI_OTHER_ADDRESS)
                            arry[i].RI_OTHER_ADDRESS = this.addressGet(arry[i].RI_OTHER_ADDRESS);
                        break;
                }
                var obj = {
                    key: key,
                    obj: arry[i]
                };
                this.fromlist.push(obj);
            }

        },
        addressGet(ad) {
            var address = ad.split(",");
            address[2] = address[2] + "," + address[3];
            address[3] = null;
            return address;
        }

    },
    activated() {
        try {

            this.$store.commit('fromlistEmpty', []);
            this.$http.get("ReportInfomation?id=" + this.$route.query["id"]).then(response => {
                var data = response.body;
                if (data.code == 1) {
                    var datajson = data.result[0];
                    this.reportuser.REPORTINFORMATION_ID = datajson.REPORTINFORMATION_ID;
                    this.reportuser.REPORTINFORMATION_IDENTITY = datajson.REPORTINFORMATION_IDENTITY;
                    this.reportuser.REPORTINFORMATION_RELATION = datajson.REPORTINFORMATION_RELATION;
                    this.reportuser.REPORTINFORMATION_USERNAME = datajson.REPORTINFORMATION_USERNAME;
                    this.reportuser.REPORTINFORMATION_WAY = datajson.REPORTINFORMATION_WAY;
                    this.reportuser.REPORTINFORMATION_TEL = datajson.REPORTINFORMATION_TEL;
                    this.reportuser.REPORTINFORMATION_EMAIL = datajson.REPORTINFORMATION_EMAIL;
                    this.reportuser.REPORTINFORMATION_CAUSE = datajson.REPORTINFORMATION_CAUSE;
                    this.reportuser.REPORTINFORMATION_IDENTITYWHY = datajson.REPORTINFORMATION_IDENTITYWHY;
                    this.listget(datajson.RI_MEDICAL, 'medical');
                    this.listget(datajson.RI_DIED, 'harmDie');
                    this.listget(datajson.RI_INJURE, 'harmDisability');
                    this.listget(datajson.RI_HMEDIA, 'rescueMeidca');
                    this.listget(datajson.RI_HCHANGE, 'rescueMove');
                    this.listget(datajson.RI_HBACK, 'rescueReturned');
                    this.listget(datajson.RI_HVISIT, 'rescueVisit');
                    this.listget(datajson.RI_HACCOMPANY, 'rescueAccompany');
                    this.listget(datajson.RI_HBURIAL, 'rescueInter');
                    this.listget(datajson.RI_ACADEMIC, 'studyBreak');
                    this.listget(datajson.RI_TRAVELDELAY, 'travelDelay');
                    this.listget(datajson.RI_LOSE, 'travelLose');
                    this.listget(datajson.RI_OTHER, 'three');

                    try {
                        var address = json.RI_MEDICAL_ADDRESS.split(",");
                        address[2] = address[2] + "," + address[3];
                        address[3] = null;
                        json.RI_MEDICAL_ADDRESS = address;
                        this.medical.RI_MEDICAL_DADDRESS = json.RI_MEDICAL_DADDRESS;
                        this.medical.RI_MEDICAL_ADDRESS = json.RI_MEDICAL_ADDRESS;
                    } catch (err) {
                        this.medical.RI_MEDICAL_ADDRESS = "";
                    }


                } else {
                    this.$notify.error({
                        title: '失败',
                        message: '数据获取失败'
                    });
                }
            }, response => {
                this.$notify.error({
                    title: '网络错误',
                    message: '网络错误'
                });
                this.loding = false;
            });
            this.$http.get("OrderList?id=" + this.$route.query["sid"]).then(response => {
                var data = response.body;

                if (data.code == 1) {
                    this.peopleinfo = data.result[0];
                } else {
                    this.$notify.error({
                        title: '失败',
                        message: '数据获取失败'
                    });
                }
            }, response => {
                this.$notify.error({
                    title: '网络错误',
                    message: '网络错误'
                });
                this.loding = false;
            });
            //是否可以编辑 true为不可编辑
            if (this.$route.query["state"] == '有未通过') {
                this.isediter = true;
            } else {
                this.isediter = false;
            }
        } catch (error) {

        }

    }

}
</script>
